package com.qclix.inv.pdf;

import com.qclix.inv.WeekDay;

import java.util.Calendar;
import java.util.Iterator;
import java.util.Locale;
import java.util.SortedSet;

/**
 * @author Pierre Moermans
 * 
 */
public class PdfCreatorHelper {
    public static String getMonthName(SortedSet<WeekDay> days) {
        Iterator<WeekDay> iterator = days.iterator();
        WeekDay firstDayPartOfInvoice = null;
        do {
            firstDayPartOfInvoice = iterator.next();
        } while (! firstDayPartOfInvoice.isPartOfInvoice());
        Calendar cal = Calendar.getInstance();
        cal.setTime(firstDayPartOfInvoice.getDate());
        String month = cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH);
        int year = cal.get(Calendar.YEAR);
        return month + " " + year;
    }
}
